def greet_user():
    """display simple greeting"""
    print("Hello!")


greet_user()

print("---------------- parameter ------------------")


def describe_pet(animal_type, pet_name):
    """display pet information"""
    print("I have a " + animal_type)
    print("My " + animal_type + "'s name is " + pet_name.title() + ".")


print("--- pass parameter by position ---")
describe_pet('hamster', 'harry')
describe_pet('harry', 'hamster')

print("--- pass parameter by key ---")
describe_pet(pet_name='harry', animal_type='hamster')

print("---------------- parameter default value ------------------")


# parameter with default value must at the end
# def describe_pet(animal_type='dog', pet_name):
def describe_pet(pet_name, animal_type='dog', ):
    """display pet information"""
    print("I have a " + animal_type)
    print("My " + animal_type + "'s name is " + pet_name.title() + ".")


describe_pet(pet_name='willie')
describe_pet('willie')
describe_pet('harry', 'hamster')
describe_pet(pet_name='harry', animal_type='hamster')

print("---------------- return value ------------------")


def get_formatted_name(first_name, last_name, middle_name=''):
    """return clear name"""
    if middle_name:
        full_name = first_name + "" + middle_name + "" + last_name
    else:
        full_name = first_name + '' + last_name
    return full_name


musician = get_formatted_name('jimi', 'hendrix')
print(musician)
musician = get_formatted_name('john', 'hooker', 'lee')
print(musician)

print("---------------- pass list dict ------------------")


def greet_users(names):
    for name in names:
        print("Hello " + name)
    names.append("wilfred")


names = ['hannah', 'ty']
print(names)
greet_users(names)
print(names)

names = ['hannah', 'ty']
print(names)
greet_users(names[:])
print(names)

print("---------------- pass vary parameters number ------------------")


def make_pizza(size, *toppings):
    """print toppings"""
    print("Making a " + str(size) + "-inch pizza with the following toppings:")
    print(toppings)


make_pizza(4, 'pepperoni')
make_pizza(4, 'mushrooms', 'green peppers', 'extra cheese')


def build_profile(first, last, **user_info):
    profile = {}
    profile['first_name'] = first
    profile['last_name'] = last
    for key, value in user_info.items():
        profile[key] = value
    return profile


user_profile = build_profile('albert', 'einstein', location='princeton', field='physics')
print(user_profile)


def aaaa(number, *strings, **keyvalues):
    print(number)
    print(strings)
    print(keyvalues)


aaaa(4, 'aa', 'bbb', 'ccc', name="aaa", age="25")
